﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.Presenter.Support;

namespace MS.InformationManagement.Presenter.TomoManagement
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class TomoManagementPresenter : BasePresenter<ITomoManagementView>
    {
        #region Constructors

        public TomoManagementPresenter(ITomoManagementView view) : base(view) { }

        #endregion

        #region Public Methods

        public void HandleLoad()
        {
            View.TomoEntity = new BLL.TomoManagement.TomoManagement().GetVolumeById(int.Parse(View.IdTomo));
            this.HandleSearchRadicados();
            View.Show();
        }

        public void HandleSearchRadicados()
        {
            int totalRecords;
            View.Radicados = new BLL.ExpedienteViewer.ExpedienteViewer().GetRadicadosByExpedienteAndVolume(View.IdExpediente, View.IdTomo, View.PageIndex, View.PageSize, out totalRecords);
            View.TotalRecords = totalRecords;
        }

        public void HandleUpdate()
        {
            new BLL.TomoManagement.TomoManagement().UpdateVolume(View.TomoEntity);
            View.TomoUpdated();
        }

        #endregion
    }
}
